import Home from '@/views/Home'
import AddFooter from '@/components/AddFooter'
// 分包
const Mall = () => import('@/views/Mall')
const Cart = () => import('@/views/Cart')
const Mine = () => import('@/views/Mine')
const Detail = () => import('@/views/Detail')
const AddCategory = () => import('@/components/AddCategory')
const routes = [
  // meta:路由元信息，设置自定义属性
  // 重定向
  {
    path: '/',
    redirect: '/home',
    meta: {
      isTabbar: false,
      isBackShow: false,
      title: '首页'
    }
  },
  {
    path: '/home',
    name: 'Home',
    components: {
      default: Home,
      'add-footer': AddFooter
    },
    meta: {
      isTabbar: true,
      title: '首页',
      icon: 'wap-home-o',
      isBackShow: false
    }
  },
  {
    path: '/mall',
    name: 'Mall',
    components: {
      default: Mall,
      'add-footer': AddFooter
    },
    children: [
      {
        path: ':id',
        component: AddCategory,
        meta: {
          isBackShow: false,
          title: '商城'
        }
      }
    ],
    meta: {
      isTabbar: true,
      title: '商城',
      icon: 'goods-collect-o',
      isBackShow: false
    }
  },
  {
    path: '/cart',
    name: 'Cart',
    components: {
      default: Cart,
      'add-footer': AddFooter
    },
    meta: {
      isTabbar: true,
      title: '购物车',
      icon: 'cart-o',
      isBackShow: false
    }
  },
  {
    path: '/mine',
    name: 'Mine',
    components: {
      default: Mine,
      'add-footer': AddFooter
    },
    meta: {
      isTabbar: true,
      title: '我的',
      icon: 'friends-o',
      isBackShow: false
    }
  },
  {
    path: '/detail',
    name: 'Detail',
    component: Detail,
    meta: {
      isTabbar: false,
      isBackShow: true,
      title: '详情页'
    }
  }
]

export default routes
